#if !defined(__EPOLL_EX_H__)
#    define __EPOLL_EX_H__

#    include <arpa/inet.h>
#    include <fcntl.h>
#    include <netinet/in.h>
#    include <signal.h>
#    include <stdio.h>
#    include <stdlib.h>
#    include <string.h>
#    include <sys/epoll.h>
#    include <sys/socket.h>
#    include <sys/types.h>
#    include <time.h>
#    include <unistd.h>
#    define SERVERPORT 8888
#    define MAX_EVENTS 10
#    define BUFFER_SIZE 1024

typedef struct Epoll_t Epoll_t;
typedef void (*EpollCallback)(Epoll_t*, int);
typedef struct EpollItem_t
{
    int           fd;
    uint32_t      event;
    EpollCallback callback;
} EpollItem_t;

typedef struct Epoll_t
{
    int          epoll_fd;
    EpollItem_t* items;
    int          items_max;
    int          items_count;
} Epoll_t;

int  epoll_init(Epoll_t* epoll);
int  epoll_add_item(Epoll_t* epoll, int fd, EpollCallback callback);
int  epoll_remove_item(Epoll_t* epoll, int fd);
void epoll_exec(Epoll_t* epoll);

#endif  // __EPOLL_EX_H__
